app.controller('updateSellerContorller', ['$scope', 'sellService', '$stateParams', 'ajax', 'Flash', function ($scope, sellService, $stateParams, ajax, Flash) {
    //alert(1);
    if ($stateParams.id) {
        sellService.detail({
            sellerId: $stateParams.id
        }).then(function (result) {
            console.log(result);
            $scope.detail = result;
        })
    } else {
        $scope.detail = {};
    }


    $scope.submit = function () {
        if($stateParams.id){
            ajax.post({
                url: 'back/seller/update',
                data: $scope.detail
            }).then(function () {
                Flash.create('success', '修改成功', 'custom-class');
            })
        }else{
            ajax.post({
                url: 'back/seller/add',
                data: $scope.detail
            }).then(function () {
                Flash.create('success', '添加成功', 'custom-class');
            })
        }

    }
}]);